package com.ruoyi.project.wenyanwen.log.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.project.wenyanwen.log.domain.TrainLog;
import com.ruoyi.project.wenyanwen.log.mapper.TrainLogMapper;
import com.ruoyi.project.wenyanwen.log.service.ITrainLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 模型训练Service业务层处理
 *
 * @author shixiangwen
 * @date 2020-08-13
 */
@Service
@DataSource(DataSourceType.KKWENYANWEN)
public class TrainLogServiceImpl implements ITrainLogService {
    @Autowired
    private TrainLogMapper trainLogMapper;

    /**
     * 查询模型训练
     *
     * @param id 模型训练ID
     * @return 模型训练
     */
    @Override
    public TrainLog selectTrainLogById(Long id) {
        return trainLogMapper.selectTrainLogById(id);
    }

    /**
     * 查询模型训练列表
     *
     * @param trainLog 模型训练
     * @return 模型训练
     */
    @Override
    public List<TrainLog> selectTrainLogList(TrainLog trainLog) {
        return trainLogMapper.selectTrainLogList(trainLog);
    }

    /**
     * 新增模型训练
     *
     * @param trainLog 模型训练
     * @return 结果
     */
    @Override
    public int insertTrainLog(TrainLog trainLog) {
        return trainLogMapper.insertTrainLog(trainLog);
    }

    /**
     * 修改模型训练
     *
     * @param trainLog 模型训练
     * @return 结果
     */
    @Override
    public int updateTrainLog(TrainLog trainLog) {
        return trainLogMapper.updateTrainLog(trainLog);
    }

    /**
     * 删除模型训练对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTrainLogByIds(String ids) {
        return trainLogMapper.deleteTrainLogByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除模型训练信息
     *
     * @param id 模型训练ID
     * @return 结果
     */
    @Override
    public int deleteTrainLogById(Long id) {
        return trainLogMapper.deleteTrainLogById(id);
    }

    @Override
    public TrainLog selectTrainTask() {
        return trainLogMapper.selectTrainTask();
    }
}
